#                                               -*- Autoconf -*-
# Process this file with autoconf to produce a configure script.

AC_PREREQ(2.61)
AC_INIT(stern, 0.1, saikat@cs.cornell.edu)
AM_INIT_AUTOMAKE

AC_CONFIG_SRCDIR([libstern/stun.c])
AC_CONFIG_HEADER([include/config.h])

# Checks for programs.
AC_PROG_CC
AM_PROG_LIBTOOL
AM_PROG_CC_C_O

# Check for the check unit test framework
PKG_CHECK_MODULES([CHECK], [check >= 0.9.4])

# Checks for libraries.
AC_CHECK_LIB([event], [event_set])
AC_CHECK_LIB([ssl], [MD5])
AC_CHECK_LIB([z], [crc32])

# Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS([arpa/inet.h inttypes.h netinet/in.h stdlib.h string.h sys/socket.h sys/time.h syslog.h unistd.h])

# Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_C_INLINE
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_HEADER_TIME
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT8_T

# Checks for library functions.
AC_FUNC_ERROR_AT_LINE
AC_FUNC_MALLOC
AC_FUNC_MEMCMP
AC_FUNC_REALLOC
AC_CHECK_FUNCS([inet_ntoa memmove memset socket strdup])

# Debugging and test coverage
AC_ARG_ENABLE([debugging],
              [AC_HELP_STRING([--enable-debugging],
                              [Enable debugging support (default=yes)])],
              [],
              [enable_debugging="yes"])
if test "x${enable_debugging}" != "xno"; then
    CFLAGS="-O0 -g -Wall"
fi

AC_CONFIG_FILES([Makefile include/Makefile src/Makefile libstern/Makefile sternd/Makefile examples/Makefile tests/Makefile])
AC_OUTPUT
